﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace Dragon.Prototype1.Infrastructure.CodeGenerator
{
    public class CodeManager
    {
        private CodeManager()
        { 
                
        }

        public static ICode CreateInstance(string codeName)
        {
            IUnityContainer container = new UnityContainer();
            UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
            section.Containers.Default.Configure(container);

            return container.Resolve(typeof(ICode), codeName) as ICode;
        }
    }
}
